using System;
using System.Data;
using System.Collections;
using System.Collections.Generic;
using System.Text;

using OgilvyOne.IDAL;
using OgilvyOne.Utility;
using OgilvyOne.Model;
namespace OgilvyOne.SqlServerDAL
{
    public class OlympicModule : CommonModule
    {
        // Methods
        private string GetIndexContent(int menuId, int contentId, int pageIndex)
        {
            return base.GetChannelIndexContent(menuId, contentId, pageIndex);
        }

        private string GetReplacedContent(int menuId, int contentId, int pageIndex)
        {
            if (contentId > 0)
            {
                return base.GetDefaultDetailContent(menuId, contentId);
            }
            int cnOrEnSubRootId = base.sm.GetCnOrEnSubRootId(menuId);
            if (menuId == cnOrEnSubRootId)
            {
                return this.GetIndexContent(menuId, contentId, pageIndex);
            }
            return base.GetErrorContent(menuId, contentId);
        }

        protected override string ReplaceContent(string templateContent, string replacedContent, int menuId, int contentId, int pageIndex, string searchType, string searchKey)
        {
            string str = replacedContent;
            if (templateContent.IndexOf("#####content#####") > 0)
            {
                str = StringUtil.ReplaceStr(str, "#####content#####", this.GetReplacedContent(menuId, contentId, pageIndex));
            }
            return str;
        }
    }
}
